<template>
  <div>
    <div class="container">
      <div class="page-title">培训人才数据库</div>
      <p class="cert-photo">
        <img :src="qrCodeInfo.photo" alt="照片" width="150">
      </p>

      <div class="grid-data">
        <div class="grid-item">
          <div class="grid-name">姓名：</div>
          <div class="grid-content">{{ qrCodeInfo.name }}</div>
        </div>
        <div class="grid-item2">
          <div class="grid-name">性别：</div>
          <div class="grid-content">{{ qrCodeInfo.gender }}</div>
        </div>
        <div class="grid-item">
          <div class="grid-name">身份证号：</div>
          <div class="grid-content">{{ qrCodeInfo.cardId }}</div>
        </div>
        <div class="grid-item2">
          <div class="grid-name">证书编号：</div>
          <div class="grid-content">{{ qrCodeInfo.certCode }}</div>
        </div>
        <div class="grid-item">
          <div class="grid-name">颁证日期：</div>
          <div class="grid-content">{{ qrCodeInfo.generateDate }}</div>
        </div>
        <div class="grid-item2">
          <div class="grid-name">职业名称：</div>
          <div class="grid-content">{{ qrCodeInfo.jobName }}</div>
        </div>
        <div class="grid-item">
          <div class="grid-name">职业等级：</div>
          <div class="grid-content">{{ qrCodeInfo.jobLevel }}</div>
        </div>
        <div class="grid-item2">
          <div class="grid-name">理论知识考试成绩：</div>
          <div class="grid-content">{{ qrCodeInfo.examScore }}</div>
        </div>
        <div class="grid-item">
          <div class="grid-name">技能考核成绩：</div>
          <div class="grid-content">{{ qrCodeInfo.skillScore }}</div>
        </div>
        <div class="grid-item2">
          <div class="grid-name">评定成绩：</div>
          <div class="grid-content">{{ qrCodeInfo.confirmScore }}</div>
        </div>
        <div class="grid-item">
          <div class="grid-name">工作单位：</div>
          <div class="grid-content">{{ qrCodeInfo.workAddress }}</div>
        </div>
      </div>

    </div>
    <footer class="qrcodeFoot">
      <p>中国人力资源岗位培训鉴定中心</p>
    </footer>
  </div>
</template>

<script>
import {getQrCodeImage} from "@/api/wmjApi";

export default {
  data() {
    return {
      qrCodeInfo: {
        id: '',
        name: '123',
        gender: '123',
        cardId: '123',
        certCode: '123',
        generateDate: '123',
        jobName: '123',
        jobLevel: '123',
        examScore: '123',
        skillScore: '',
        confirmScore: '',
        workAddress: '',
        photo: ''
      }
    }
  },
  methods: {
    getQrCodeImage(code) {
      getQrCodeImage(code).then(res => {
        this.qrCodeInfo = res
        this.qrCodeInfo.photo = res.photo.replaceAll('/project/media/temp/', 'https://www.yunox.cn/temp/')
        document.title = (this.qrCodeInfo.name || '') + "的培训人才数据库"
      })
    }
  },
  mounted() {
    const urlParams = new URLSearchParams(window.location.search);
    const code = urlParams.get('code');
    if (code) {
      this.getQrCodeImage(code);
    }

  }

}

</script>


<style scoped>
.container {
  max-width: 1440px;
  margin: 0 auto;
}

.page-title {
  background: #d0d9d2;
  color: #513d45;
  font-weight: bolder;
  font-size: 24px;
  height: 50px;
  display: flex;
  align-items: center; /* 垂直居中 */
  justify-content: center; /* （如果想水平也居中） */
}


.grid-item {
  height: 5.2vh;
  background: #ecdee3;
  display: flex;
  align-items: center; /* 新增 */
}

.grid-item2 {
  height: 5.2vh;
  background: #eff7ee;
  display: flex;
  align-items: center; /* 新增 */
}

.grid-name {
  font-weight: 600;
  flex: 5;
  text-align: right; /* 右对齐 */
  padding-right: 8px; /* 右边留点间距 */
}

.grid-content {
  flex: 6;
  text-align: left; /* 左对齐 */
  padding-left: 8px; /* 左边留点间距 */
}

.qrcodeFoot {
  margin-top: 5px;
  font-size: 15px;
  background: #d5bdc5;
  height: 5.5vh;
  width: 100%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8e6370;
}

</style>